import type { AxiosRequestConfig, AxiosResponse } from 'axios'

interface HYInstanceInterceptors<T = AxiosResponse> {
  // TODO: 不是很理解ts的类型维护，暂时先写any script
  // requestSuccessFn?: (config: AxiosRequestConfig) => AxiosRequestConfig
  requestSuccessFn?: (config: any) => any
  requestFailFn?: (err: any) => any
  responseSuccessFn?: (res: AxiosResponse<T>) => AxiosResponse<T>
  responseFailFn?: (err: any) => any
}

export interface RequestConfig<T = AxiosResponse> extends AxiosRequestConfig {
  interceptors?: HYInstanceInterceptors<T>
}
